﻿using RBAC_Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RBAC_Application.Repository.Interface
{
    public interface IUserRepository
    {
        // 查询
        /// <summary>
        /// 根据用户ID查询用户
        /// </summary>
        /// <param name="id">用户ID</param>
        /// <returns>用户对象</returns>
        User GetById(long id);
        /// <summary>
        /// 根据用户名查询用户
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <returns>用户对象</returns>
        User GetByUserName(string userName);
        /// <summary>
        /// 获取所有用户
        /// </summary>
        /// <returns>用户列表</returns>
        List<User> GetAll();
        /// <summary>
        /// 根据条件查询用户
        /// </summary>
        /// <param name="keyword">关键字</param>
        /// <param name="isActive">是否激活</param>
        /// <returns>用户列表</returns>
        List<User> GetByCondition(string keyword, bool? isActive);

        // 增删改
        /// <summary>
        /// 添加用户
        /// </summary>
        /// <param name="user">用户对象</param>
        void Add(User user);
        /// <summary>
        /// 更新用户
        /// </summary>
        /// <param name="user">用户对象</param>
        void Update(User user);
        /// <summary>
        /// 删除用户
        /// </summary>
        /// <param name="id">用户ID</param>
        public void DeleteUser(long id);
        /// <summary>
        /// 检查用户名是否存在
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <returns>是否存在</returns>
        bool Exists(string userName);
    }
}
